// 引入请求方法 request
import request from './request';

// 获取用户信息
export const getUser = () => {
  return request({
    url: '/users',
    method: 'get',
  });
};

// 获取单个用户信息
export const getSingleUser = (id) => {
  return request({
    url: `/users/${id}`,
    method: 'get',
  });
};

// 创建新用户
export const createUser = (data) => {
  return request({
    url: '/users',
    method: 'post',
    data: data,
  });
};

// 更新用户信息
export const updateUser = (id, data) => {
  return request({
    url: `/users/${id}`,
    method: 'put',
    data: data,
  });
};
